package com.googlecode.animator.data.objects3d
{
	import com.googlecode.animator.data.IValueObject;
	import com.googlecode.animator.data.materials.BitmapFileMaterialVO;
	import com.googlecode.animator.data.materials.ColorMaterialVO;
	import com.googlecode.animator.data.materials.FileAssetMaterialVO;
	import com.googlecode.animator.data.materials.MaterialVO;
	import com.googlecode.animator.data.materials.MovieMaterialVO;
	import com.googlecode.animator.data.materials.VideoStreamMaterialVO;
	
	import flash.utils.Dictionary;
	
	public class CubeVO extends MaterialsListObject3DVO
	{
		
		public static const TYPE:String = "Cube";
		
		public static const FRONT_FACE:String = "front";
		
		public static const BACK_FACE:String = "back";
		
		public static const TOP_FACE:String = "top";
		
		public static const BOTTOM_FACE:String = "bottom";
		
		public static const LEFT_FACE:String = "left";
		
		public static const RIGHT_FACE:String = "right";
		
		public var width:Number = 500;
		
		public var height:Number = 500;
		
		public var depth:Number = 500;
		
		public var segmentsS:uint = 4;
		
		public var segmentsT:uint = 4;
		
		public var segmentsH:uint = 4;
	
		
		public function CubeVO()
		{
			selectedFace = BACK_FACE;
			
			label = "Default Cube";			
		}
		
		override public function clone(src:* = null):IValueObject
		{
			var clone:IValueObject = super.clone(new CubeVO());

			(clone as CubeVO).width = this.width;
			(clone as CubeVO).height = this.height;
			(clone as CubeVO).depth = this.depth;
			(clone as CubeVO).segmentsH = this.segmentsH;
			(clone as CubeVO).segmentsS = this.segmentsS;
			(clone as CubeVO).segmentsT = this.segmentsT;			
			(clone as CubeVO).selectedFace = this.selectedFace;
			
			return (clone as CubeVO);
		}
		
		override public function toXML(src:XML = null):XML
		{
			var xml:XML = super.toXML(new XML(<{TYPE} name={this.name} label={this.label}></{TYPE}>));

			xml.appendChild(<width>{int(this.width * this.scaleX)}</width>);
			xml.appendChild(<height>{int(this.height * this.scaleY)}</height>);
			xml.appendChild(<depth>{int(this.depth * this.scaleZ)}</depth>);

			return xml;
		}
		
		override public function fromXML(src:XML):void
		{
			super.fromXML(src);

			this.width = src.width;
			this.height = src.height;
			this.depth = src.depth;	
		}
	}
}